#include <stdio.h>
#include <stdlib.h>
#include "alarm.h"

int main()
{
    int is_quit = 0;
    while (is_quit == 0)
    {
        printf("请输入报警编号(输入`q`退出): ");
        char alarm_id[] = "";
        scanf("%s", &alarm_id);

        if (alarm_id[0] == 'q')
        {
            is_quit = 1;
            break;
        }
        int alarm_id_number = 0;
        alarm_id_number = atoi(alarm_id);
        switch (alarm_id_number)
        {
        case UPPER_LIMIT_ABS_ALARM:
            upper_limit_abs_alarm_handler(0, 0);
            break;
        case LOWER_LIMIT_ABS_ALARM:
            lower_limit_abs_alarm_handler(0, 0);
            break;
        case UPPER_LIMIT_ABS_HOLD_ALARM:
            upper_limit_abs_hold_alarm_handler(0, 0);
            break;
        case LOWER_LIMIT_ABS_HOLD_ALARM:
            lower_limit_abs_hold_alarm_handler(0, 0);
            break;
        case UPPER_LIMIT_DEVIATION_ALARM:
            upper_limit_deviation_alarm_handler(0, 0, 0);
            break;
        case LOWER_LIMIT_DEVIATION_ALARM:
            lower_limit_deviation_alarm_handler(0, 0, 0);
            break;
        case UPPER_AND_LOWER_LIMIT_DEVIATION_ALARM:
            upper_and_lower_limit_deviation_alarm_handler(0, 0, 0);
            break;
        case UPPER_LIMIT_DEVIATION_HOLD_ALARM:
            upper_limit_deviation_hold_alarm_handler(0, 0, 0);
            break;
        case LOWER_LIMIT_DEVIATION_HOLD_ALARM:
            lower_limit_deviation_hold_alarm_handler(0, 0, 0);
            break;
        case UPPER_AND_LOWER_LIMIT_DEVIATION_HOLD_ALARM:
            upper_and_lower_limit_deviation_hold_alarm_handler(0, 0, 0);
            break;
        case RANGE_DEVIATION_ALARM:
            range_deviation_alarm_handler(0, 0, 0);
            break;
        case OFFLINE_ALARM:
            offline_alarm_handler();
            break;
        case DOUBLE_UPPER_AND_LOWER_LIMIT_ABS_ALARM:
            double_upper_lower_limit_abs_alarm_handler(0, 0, 0);
            break;
        case DOUBLE_UPPER_AND_LOWER_LIMIT_DEVIATION_ALARM:
            double_upper_lower_limit_deviation_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_UPPER_LIMIT_ABS_AND_LOWER_LIMIT_DEVIATION_ALARM:
            double_upper_limit_abs_and_lower_limit_deviation_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_UPPER_LIMIT_DEVIATION_AND_LOWER_LIMIT_ABS_ALARM:
            double_upper_limit_deviation_and_lower_limit_abs_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_UPPER_AND_LOWER_LIMIT_ABS_HOLD_ALARM:
            double_upper_lower_limit_abs_hold_alarm_handler(0, 0, 0);
            break;
        case DOUBLE_UPPER_AND_LOWER_LIMIT_DEVIATION_HOLD_ALARM:
            double_upper_lower_limit_deviation_hold_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_UPPER_LIMIT_ABS_AND_LOWER_LIMIT_DEVIATION_HOLD_ALARM:
            double_upper_limit_abs_and_lower_limit_deviation_hold_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_UPPER_LIMIT_DEVIATION_AND_LOWER_LIMIT_ABS_HOLD_ALARM:
            double_upper_limit_deviation_and_lower_limit_abs_hold_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_RANGE_ABS_ALARM:
            double_range_abs_alarm_handler(0, 0, 0);
            break;
        case DOUBLE_RANGE_DEVIATION_ALARM:
            double_range_deviation_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_RANGE_UPPER_LIMIT_ABS_AND_LOWER_LIMIT_DEVIATION_ALARM:
            double_range_upper_limit_abs_and_lower_limit_deviation_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_RANGE_UPPER_LIMIT_DEVIATION_AND_LOWER_LIMIT_ABS_ALARM:
            double_range_upper_limit_deviation_and_lower_limit_abs_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_RANGE_ABS_HOLD_ALARM:
            double_range_abs_hold_alarm_handler(0, 0, 0);
            break;
        case DOUBLE_RANGE_DEVIATION_HOLD_ALARM:
            double_range_deviation_hold_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_RANGE_UPPER_LIMIT_ABS_AND_LOWER_LIMIT_DEVIATION_HOLD_ALARM:
            double_range_upper_limit_abs_and_lower_limit_deviation_hold_alarm_handler(0, 0, 0, 0);
            break;
        case DOUBLE_RANGE_UPPER_LIMIT_DEVIATION_AND_LOWER_LIMIT_ABS_HOLD_ALARM:
            double_range_upper_limit_deviation_and_lower_limit_abs_hold_alarm_handler(0, 0, 0, 0);
            break;
        default:
            break;
        }
        // 清空缓冲区
        int c;
        while ((c = getchar()) != '\n' && c != EOF)
            ;
    }

    return 0;
}